-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hardening suggestions for WebGoat_12_23 / another-latest #97
base: another-latest
Are you sure you want to change the base?
Conversation
@@ -135,7 +136,9 @@ public void print2() { | |||
public static class EncryptionExample { | |||
|
|||
public byte[] encrypt(String text) throws Exception { | |||
int a, b, c; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Split variable declarations into their own statements.
@@ -79,8 +80,8 @@ public ModelAndView importFile(@RequestParam("file") MultipartFile myFile) throw | |||
var user = (WebGoatUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); | |||
var destinationDir = new File(fileLocation, user.getUsername()); | |||
destinationDir.mkdirs(); | |||
myFile.transferTo(new File(destinationDir, myFile.getOriginalFilename())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrapped the file name with a sanitizer call that takes out path escaping characters
@@ -79,8 +80,8 @@ public ModelAndView importFile(@RequestParam("file") MultipartFile myFile) throw | |||
var user = (WebGoatUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); | |||
var destinationDir = new File(fileLocation, user.getUsername()); | |||
destinationDir.mkdirs(); | |||
myFile.transferTo(new File(destinationDir, myFile.getOriginalFilename())); | |||
log.debug("File saved to {}", new File(destinationDir, myFile.getOriginalFilename())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrapped the file name with a sanitizer call that takes out path escaping characters
Quality Gate passedIssues Measures |
I've reviewed the recently opened PR (96 - another latest) and have identified some area(s) that could benefit from additional hardening measures.
These changes should help prevent potential security vulnerabilities and improve overall code quality.
Thank you for your consideration!
🧚🤖 Powered by Pixeebot
💬Feedback | 👥Community | 📚Docs